package com.interest.base.utils;

import org.apache.log4j.Logger;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.UUID;

/**
 * Created by yangfeng on 16-11-10.
 */
public class TokenUtils {
    private static Logger logger = Logger.getLogger(TokenUtils.class);

    public static String generateToken() {
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
        String tokenOrigin = UUID.randomUUID().toString() + format.format(new Date());
        String token = MD5.GetMD5Code(tokenOrigin);
        logger.info("tokenOrigin : " + tokenOrigin + ", token = " + token);
        return token;
    }
}
